import pickle
import math


def participle(data_transform, word_len, data_nums):
    # 分词并保存原始分词结果，词语长度后期可以再改
    for i in range(math.ceil(data_nums / 100000)):
        # 原始分词
        texts = data_transform.extraction['fact'][i * 100000:(i * 100000 + 100000)]
        big_fact_cut = data_transform.cut_texts(texts=texts, word_len=1, need_cut=True)
        with open('data/preprocess/participle/fact_%d_%d.pkl' % (i * 100000, i * 100000 + 100000), mode='wb') as f:
            pickle.dump(big_fact_cut, f)

        big_fact_cut_new = data_transform.cut_texts(texts=big_fact_cut, word_len=word_len, need_cut=False)
        with open('data/preprocess/participle/fact_%d_%d_%d.pkl' % (i * 100000, i * 100000 + 100000, word_len), mode='wb') as f:
            pickle.dump(big_fact_cut_new, f)
        print('finish fact_%d_%d' % (i * 100000, i * 100000 + 100000))


